<template>
  <!-- 添加收货地址 -->
  <div>
    <header class="AddddtextBox">
      <van-row>
        <van-col class="AddddMarginTop" span="24">
          <van-row class="AddAddtextBox">
            <van-col @click="addAdderssReturn">
              <van-icon name="arrow-left" size="40" />
            </van-col>
            <van-col> 选择收货地址 </van-col>
          </van-row>
        </van-col>
      </van-row>
    </header>
    <section style="margin-top: 80px"></section>
    <section>
      <van-row>
        <van-col span="24">
          <van-address-edit
            :area-list="areaList"
            show-postal
            show-delete
            show-set-default
            show-search-result
            :search-result="searchResult"
            :area-columns-placeholder="['请选择', '请选择', '请选择']"
            @save="onSave"
            @change-detail="onChangeDetail"
          />
        </van-col>
      </van-row>
    </section>
  </div>
</template>

<script>
const areaList = {
  province_list: {
    110000: "北京市",
    120000: "天津市",
  },
  city_list: {
    110100: "北京市",
    120100: "XXX",
  },
  county_list: {
    110101: "东城区",
    110102: "西城区",
    120101: "东城区",
    120102: "西城区",
    // ....
  },
};
export default {
  data() {
    return {
      areaList,
      searchResult: [],
    };
  },
  methods: {
    addAdderssReturn() {
      this.$router.back();
    },
    ADadderssNext() {
      this.$router.push("/saveAdderss");
    },
    onSave() {
      //   Toast('save');
      this.ADadderssNext();
    },
    onChangeDetail(val) {
      if (val) {
        this.searchResult = [
          {
            name: "黄龙万科中心",
            address: "杭州市西湖区",
          },
        ];
      } else {
        this.searchResult = [];
      }
    },
  },
};
</script>

<style>
.AddddtextBox {
  position: fixed;
  top: 0;
  width: 100%;
  height: 35px;
  background-color: #4bd863;
  z-index: 9999;
  padding: 10px 0;
}
.AddddMarginTop {
  /* margin-top: 35px; */
  /* padding: 10px 0; */
}
.AddAddtextBox {
  height: 35px;
  line-height: 40px;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}
</style>